﻿using System;
using System.Collections.Generic;
using System.Text;
using FunctionalCLR.Core.Function;

namespace FunctionalCLR.Core {
    public class TanhNode : FuncNode {

        public TanhNode()
            : base() {
            base.Value = "tanh";
            this.ParameterCount = 1;
        }

        public override object Accept(IVisitor visitor) {
            return visitor.Visit(this);
        }

        public override FuncNode GetReversedFunction(int index) {
            return new SinNode();
        }

        public override object Evaluate() {
            double result = Convert.ToDouble(Children[0].Evaluate());

            return SpecialFunction.tanh(result).ToString();
        }
    }
}
